package com.scraper.articles.web.service.impl;

import com.scraper.articles.web.model.Request;
import com.scraper.articles.web.dao.RequestDao;
import com.scraper.articles.web.service.RequestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class RequestServiceImpl implements RequestService {

	@Autowired
	private RequestDao requestDao;

	@Transactional
	public void saveRequest(Request request) {
		requestDao.saveRequest(request);
	}

	@Transactional(readOnly = true)
	public List<Request> listRequests() {
		return requestDao.listRequests();
	}

	@Transactional(readOnly = true)
	public Request getRequest(Long id) {
		return requestDao.getRequest(id);
	}

	@Transactional
	public void deleteRequest(Long id) {
		requestDao.deleteRequest(id);

	}

}
